// 获取id
let url=decodeURI(window.location.href);
var cs=url.split("?")[1].split("=");
var csKey=cs[0].toLowerCase()
var csvalue=+cs[1];
let o ={[csKey]:csvalue};
console.log(o);

// 获取数据进行渲染
var product=document.querySelector("#product");
let xhr1=new XMLHttpRequest();
 xhr1.open("get","http://chst.vip:1234/api/getdiscountproduct?productid="+csvalue,true);
 xhr1.onload=function(){
     let lis1="";
     if(xhr1.status===200){
         let res1=JSON.parse(xhr1.responseText);
         console.log(res1.result);
         var x=res1.result;
         x.forEach(element => {
                    console.log(element);
                    lis1=`
                    <ul class="info">
                    <li class="infoa">
                                        <div class="title">
                                        <h4>${element.productName}</h4>
                                        </div>
                                        <div class="other">
                                                            <span>${element.productFrom}|${element.productTime}</span>
                                                            <i>${element.productTips}</i>
                                        </div>
                                        <div class="ppp">
                                                            ${element.productPrice}
                                        </div>
                                        <div class="container">
                                                            <p>
                                                            ${element.productInfo}
                                                            </p>
                                                            ${element.productImg}
                                                            
                                        </div>
                                     
                                        
                    </li>          
                    </ul>
         `
         });
         
}
product.innerHTML=lis1;
}
xhr1.send();